/*
 * @Author: your name
 * @Date: 2024-05-08 11:22:24
 * @LastEditTime: 2024-05-08 11:47:38
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \.leetcode\17.电话号码的字母组合.cpp
 */
/*
 * @lc app=leetcode.cn id=17 lang=cpp
 *
 * [17] 电话号码的字母组合
 */

// @lc code=start
class Solution {
private:
    const string table[10] = {
        "",
        "",
        "abc",
        "def",
        "ghi",
        "jkl",
        "mno",
        "pqrs",
        "tuv",
        "wxyz",
    };
public:
    
    vector<string> res;
    string path;

    void backtracking(string& digits, int count){
        if(count == digits.size()){
            res.push_back(path);
            return;
        }
        int index = digits[count] - '0';
        string letters = table[index];
        for(int i = 0; i < letters.size(); i++){
            path.push_back(letters[i]);
            backtracking(digits, count + 1);
            path.pop_back();
        }

    }
    vector<string> letterCombinations(string digits) {
        if(digits.size() == 0){
            return {};
        }
        backtracking(digits, 0);
        return res;
    }
};
// @lc code=end

/**
 * res
 * path
void backtracking(digits, index){
    if(path.size == index){
        res.push_back(path);
        return
    }
    for(int i = 0; i < digits.size(); i++){
        path.push_back
        backtracking()
        path.pop_back
    }
}
*/